﻿#ifndef TARGETCLI_H
#define TARGETCLI_H

#include <QObject>
#include <QNetworkReply>
#include <QTcpSocket>
#include <QTimer>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <QVector>
#include "oeasycommon.h"
#include "ipc.h"

class TargetCli : public QObject
{
    Q_OBJECT
public:
    explicit TargetCli(QString &id, STRUCT_TARGET_INFO &cfg, QList<IPC *> &ipcList, QObject *parent = 0);
    ~TargetCli();

private:
    QString &m_proxyId;
    QTcpSocket m_sock;
    STRUCT_TARGET_INFO &m_cfg;
    QTimer m_timer;
    QList<IPC *> &m_ipcList;
    QJsonArray m_ipcArray;
    QByteArray m_msg;
    QVector<QJsonArray> m_snapArray;
    int m_nCountPeople;

signals:
    void textRecv(QString);
    void postPic(QByteArray);
    void postReport(QByteArray);
    void postBigData(QByteArray);

public slots:
    void onRead();
    void onTimeout();
    void onError(QAbstractSocket::SocketError);
};

#endif // TARGETCLI_H
